package com.TeamJigsaw.DanteTrail.Views;


import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.event.ActionListener;

import javax.swing.*;


import com.TeamJigsaw.DanteTrail.Views.Interfaces.PartySetupInterface;

import net.miginfocom.swing.MigLayout;

public class PartySetupView extends JPanel implements PartySetupInterface{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextField textField;
	private JTextField textField_1;
	private JTextField textField_2;
	private JTextField textField_3;
	private JButton btnBack, btnNext;
	private JLabel lblSetupYourParty;
	
	public PartySetupView() {
		
		setSize(new Dimension(700,700));
		
		initialize();

	}
	private void initialize() {
		
		setLayout(new MigLayout("", "[grow]", "[grow]"));
		
		JPanel panel = new JPanel();
		panel.setOpaque(false);
		add(panel);
		panel.setLayout(new MigLayout("", "[60px:60px:60px][230:230:230][10px:10:10px][200px:200px:200px][160px:160px:160px]", "[100px:100px:100px][][30px:30px:30px][30px:30:30px][30px:30px:30px][30px:30px:30px][30px:30px:30px][30px:30px:30px][30px:30px:30px][30px:30px:30px][30px:30px:30px][40px:40px:40px][200px:200px:200px]"));
		
		lblSetupYourParty = new JLabel("<html><font size=\"5\" color=\"#FFFFFF\"><b>Setup Your Party For the Trail!</b></font></html>");
		panel.add(lblSetupYourParty, "cell 3 1 2 1");
		
		JLabel lblPlayerName = new JLabel("<html><font size=\"5\" color=\"#FFFFFF\"><b>Player's Name:</b></font></html>");
		panel.add(lblPlayerName, "cell 1 3");
		
		textField = new JTextField();
		panel.add(textField, "cell 3 3,growx");
		textField.setColumns(10);
		
		JLabel lblPartyMembers = new JLabel("<html><font size=\"5\" color=\"#FFFFFF\"><b>Party Member 1's Name:</b></font></html>");
		panel.add(lblPartyMembers, "cell 1 5");
		
		textField_1 = new JTextField();
		panel.add(textField_1, "cell 3 5,growx");
		textField_1.setColumns(10);
		
		JLabel lblPartyMembers_1 = new JLabel("<html><font size=\"5\" color=\"#FFFFFF\"><b>Party Member 2's Name:</b></font></html>");
		panel.add(lblPartyMembers_1, "cell 1 7");
		
		textField_2 = new JTextField();
		panel.add(textField_2, "cell 3 7,growx");
		textField_2.setColumns(10);
		
		JLabel lblPartyMembers_2 = new JLabel("<html><font size=\"5\" color=\"#FFFFFF\"><b>Party Member 3's Name:</b></font></html>");
		panel.add(lblPartyMembers_2, "cell 1 9");
		
		textField_3 = new JTextField();
		panel.add(textField_3, "cell 3 9,growx");
		textField_3.setColumns(10);
		
		btnBack = new JButton("Back");
		panel.add(btnBack, "cell 1 11,growy");
		
		btnNext = new JButton("Next");
		panel.add(btnNext, "cell 3 11,alignx right,growy");
	}
	@Override
	public String getPlayerName() {
		// TODO Auto-generated method stub
		return textField.getText();
	}
	@Override
	public String getMember1Name() {
		// TODO Auto-generated method stub
		return textField_1.getText();
	}
	@Override
	public String getMember2Name() {
		// TODO Auto-generated method stub
		return textField_2.getText();
	}
	@Override
	public String getMember3Name() {
		// TODO Auto-generated method stub
		return textField_3.getText();
	}
	@Override
	public void setNextListener(ActionListener listen) {
		btnNext.addActionListener(listen);
		
	}
	@Override
	public void setBackListener(ActionListener listen) {
		btnBack.addActionListener(listen);
		
	}
	
	@Override
	public boolean listenersExist() {
		if(btnNext.getActionListeners().length > 0)
		{
			return true;
		}
		return false;
	}
	
	@Override
	public void paintComponent(Graphics g) {
		ImageIcon img = new ImageIcon("resources\\stone_texture.png");
	    g.drawImage(img.getImage(), 0, 0, null);
	  }
}
